package com.threadPool.providerConsumer;

import java.util.Random;

/**
 * @author: dong peng
 * @date: 2019/6/3 18:30
 * @description:
 */

public class Producer implements Runnable{

    private ShareResource resource;

    public Producer(ShareResource shareResource) {
        this.resource = shareResource;
    }

    @Override
    public void run() {
            for(int i = 0; i< 100; i++) {
                System.out.println("生产内容： " +Thread.currentThread().getName() + " "+ i );
                resource.add(String.valueOf(i));
            }

            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

    }
}
